//
//  NSString+path.h
//  helper
//
//  Created by huangyi on 12-10-29.
//  Copyright (c) 2012年 huangyi. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSString (path)

-(BOOL)isFile;
-(BOOL)isDir;
-(BOOL)isFileOrDir;
-(BOOL)isWriteable;

-(BOOL)createFile;
-(BOOL)createDir;
-(BOOL)removeFile;
-(BOOL)removeDir;
-(BOOL)removeFileOrDir;
-(BOOL)removeDirContents;

-(NSArray*)listDir;

-(NSString*)rootPath;
-(NSString*)docPath;
-(NSString*)appPath;
-(NSString*)mediaPath;
-(NSString*)cachePath;
-(NSString*)tempPath;
-(NSString*)trashPath;

-(NSString*)userPath;

-(NSDate*)fileCreationDate;
-(NSDate*)fileModificationDate;
-(NSUInteger)fileSize;

-(NSData*)fileData;

-(NSData*)read;
-(BOOL)write:(NSData*)data;
-(BOOL)append:(NSData*)data;

-(BOOL)moveToDir:(NSString*)path;
-(BOOL)copyToDir:(NSString*)path;
-(BOOL)moveTo:(NSString*)path;
-(BOOL)copyTo:(NSString*)path;


@end
